fix: recognize custom subtitle addons like Wizdom and Ktuvit (#80) - #127
Merged
Conversation
User-added Stremio addons that declared only the `subtitles` resource in their manifest (Wizdom, Ktuvit, and other regional subtitle providers) were installed successfully but were functionally inert. The root cause was two-fold: 1. `StreamRepository.addCustomAddon` hardcoded `type = AddonType.CUSTOM` for every user-added addon regardless of what resources its manifest declared. So a pure-subtitle addon ended up in the same bucket as a stream addon. 2. `fetchSubtitlesForSelectedStream` then filtered strictly on `type == AddonType.SUBTITLE`, which only matched the built-in OpenSubtitles addon. Pure-subtitle addons stored as CUSTOM were never queried for subtitles. The result was that Israeli users who added Wizdom or Ktuvit saw them listed and enabled in Settings \u2192 Addons but never saw any Hebrew subtitles appear during playback \u2014 effectively making ARVIO unusable for them as reported in issue #80. Changes: - `addCustomAddon` now inspects the parsed manifest's resources. If the addon declares `subtitles` but not `stream`, it gets `AddonType.SUBTITLE`; otherwise it stays CUSTOM (preserving the existing behavior for stream addons and hybrid addons). - `fetchSubtitlesForSelectedStream` now also includes CUSTOM-typed addons whose manifest declares a `subtitles` resource. This covers two cases: (a) addons installed before this fix that are still classified as CUSTOM in DataStore; (b) hybrid addons that legitimately provide both streams and subtitles and should be queried for both. - The stream-side filter in `getStreamAddons` already requires CUSTOM addons to declare `stream` resource, so newly-classified SUBTITLE addons are correctly excluded from stream fetches and don't pollute the stream picker. Existing users with Wizdom/Ktuvit already installed will benefit immediately from change (2) without needing to reinstall. New installations will benefit from both changes. Closes #80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #80.
User-added Stremio subtitle addons like Wizdom and Ktuvit (the primary Hebrew subtitle providers for Israeli users) were installed successfully but were functionally inert — they showed up in Settings → Addons, could be enabled/disabled, but were never queried during playback. No Hebrew subtitles ever appeared in the player.
Root cause
Two sequential bugs:
StreamRepository.addCustomAddonat line 259 hardcodedtype = AddonType.CUSTOMfor every user-added addon, regardless of what resources the manifest declared. So a pure-subtitle addon (manifestresources: ["subtitles"]) ended up in the same bucket as a pure-stream addon (manifestresources: ["stream"]).fetchSubtitlesForSelectedStreamat line 1339 filtered strictly ontype == AddonType.SUBTITLE, which only matched the built-in OpenSubtitles addon. Pure-subtitle addons stored as CUSTOM were never queried for subtitles.The result: the addon was installed, the toggle worked, the stream resolver correctly ignored it (because
getStreamAddonsrequires astreamresource in the manifest), but no code path ever actually fetched subtitles from it.Fix
1. Classify addons by manifest resources at install time
addCustomAddonnow inspects the parsed manifest's resources:SUBTITLE→ picked up by the subtitle fetcher, ignored by the stream fetcher.CUSTOMwithstreamresource → picked up by the stream fetcher only (unchanged behavior).streamandsubtitles) →CUSTOM→ picked up by the stream fetcher AND by the subtitle fetcher's new branch (see below).2. Broaden the subtitle fetcher to include CUSTOM addons that declare subtitles
fetchSubtitlesForSelectedStreamnow also queries CUSTOM addons whose manifest has asubtitlesresource:This covers two cases the type-classification fix alone doesn't:
Why the stream side is already correct
getStreamAddonsat line 625 already skipsAddonType.SUBTITLE, and at line 632-641 requires CUSTOM addons to declare astreamresource in the manifest. So newly-classified SUBTITLE addons are correctly excluded from stream fetches and won't pollute the stream picker with "no streams available" entries.Test matrix
streamresource) ✓Risk
Low. Single file, 40-line change. The stream-side filter logic is untouched. The subtitle-side filter is a strict superset of the previous filter — no previously-queried addon will stop being queried. All new behavior is additive.
One very small edge case worth noting: the subtitle URL construction (
buildSubtitlesUrl) has been working for OpenSubtitles for months and follows the standard Stremio protocol (/subtitles/{type}/{id}.json). Wizdom and Ktuvit follow the same protocol, so it should work out of the box, but if a specific provider turns out to need an unusual query format we can iterate in a follow-up PR.